<extend name="Public:base"/>

<block name="main">
<div id="yzh-content">

    <div class="main-title">
        <h2>友情链接</h2>
    </div>

    <div class="table-actions">
        <a class="btn btn-sm btn-primary" onclick="myform.action='{:U('Link/deleteall')}';return confirm_deleteall()">删除</a>
        <a class="btn btn-sm btn-primary" onclick="myform.action='{:U('Link/listorder')}';$('#myform').submit();" >排序</a>
        <a href="{:U('Link/add')}" id="addyoul" class="btn btn-sm btn-primary">添加友链</a>
    </div>

    <form name="myform" id="myform" action="" method="post">
        <table class="table table-hover table-bordered">
            <thead>
                <tr>
                    <th width="20"><input type="checkbox" value="" id="check_box" onclick="selectall('ids[]');"></th>
                    <th class="table-cell-1">{:L('listorder')}</th>
                    <th width="40">ID</th>
                    <th>名称</th>
                    <th>网站地址</th>
                    <th>logo</th>
                    <th class="table-cell-3">发布时间</th>
                    <th class="table-cell-2 center">管理操作</th>
                </tr>
            </thead>
            <tbody>
                <volist name="list" id="vo" key="k">
                <tr>
                <td width="20" align="center"><input class="inputcheckbox " name="ids[]" value="{$vo['id']}" type="checkbox" ></td>
                <td width="30"><input name='listorders[{$vo.id}]' type='text' size='3' value='{$vo.listorder}' class='input-text-c'></td>
                <td>{$vo['id']}<input class="id" type="hidden" name="id" value="{$vo['id']}"></td>
                <td>{$vo['name']}</td>
                <td>{$vo['siteurl']}</td>
                <td><if condition="$vo['weblogo']"><img src="{$vo['weblogo']}" height=26></if>&nbsp;</td>
                <td align="center">{$vo['createtime']|todate="Y-m-d H:i:s"}</td>
                <td class="table-cell-2 center">
                    <a class="btn btn-xs btn-primary" href="{:U('Link/edit',array('id'=>$vo['id']))}">编辑</a>
                    <a class="btn btn-xs btn-danger" href="javascript:confirm_delete('{:U('Link/delete',array(id=>$vo['id']))}')">{:L('delete')}</a>
                </td>
                </tr>
                </volist>
            </tbody>
        </table>
    </form>
    <div id="pages">{$page}</div>
</div>
<script>
// 确认删除
function confirm_deleteall(){
    $.scojs_confirm({
        content: "<h4>确认要删除信息吗?</h4>",
        action: function(){
            $('#myform').submit();
        }
    }).show();
}
</script>
</block>